<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich">
<h:head>
	<title>Fiap Airport Web</title>
</h:head>
<h:body>
	<ui:include src="/cliente/menu.xhtml"/>
	<rich:panel header="Lista de Voo">
	<h:form>
		<div>
			<span>Número do Voo:</span>
			<h:inputText value="#{filtroVooBean.filtroVoo.numero}" />
		</div>
    	<p>
			<h:commandButton action="#{filtroVooBean.filtrarVoos()}" value="Filtrar" />
			<h:commandButton action="#{vooBean.novoVoo()}" value="Novo" />
		</p>
		
		<h:dataTable id="voosTable" value="#{filtroVooBean.voos}" var="voo">
			<f:facet name="header">
				<h:outputText value="Lista de Voos" />
			</f:facet>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Número do Voo" />
				</f:facet>
				<h:commandLink action="#{vooBean.recuperarVoo(voo.numero)}" value="#{voo.numero}" />
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Descrição" />
				</f:facet>
				<h:outputText value="#{voo.descricao}" />
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Assentos Econômicos Disponíneis" />
				</f:facet>
				<h:outputText value="#{voo.totalAssentosEconomicos - voo.assentosEconomicosOcupados}" />
			</h:column>
			<h:column>
				<f:facet name="header">
					<h:outputText value="Assentos Executivos Disponíneis" />
				</f:facet>
				<h:outputText value="#{voo.totalAssentosExecutivos - voo.assentosExecutivosOcupados}" />
			</h:column>			
			<h:column>
				<f:facet name="header">
					<h:outputText value="Ação" />
				</f:facet>
				<h:commandLink action="#{filtroVooBean.excluirVoo(voo.numero)}" value="Excluir" />
			</h:column>
		</h:dataTable>

	</h:form>
	</rich:panel>
</h:body>
</html>
